package org.jeecg.modules.solitaire_app.app.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.solitaire_app.app.entity.YsyUserAddress;
import org.jeecg.modules.solitaire_app.app.mapper.YsyUserAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping(value = "/app/html")
public class TestHtmlController {

    @Autowired
    private YsyUserAddressMapper ysyUserAddressMapper;


    @GetMapping("/")
    public String index(Model model) {
        List<YsyUserAddress> ysyUserAddresses = ysyUserAddressMapper.selectList(Wrappers.lambdaQuery());
        model.addAttribute("myList",ysyUserAddresses);
        return "index";
    }

    @GetMapping("/p")
    public String getP(Model model) {
        List<YsyUserAddress> ysyUserAddresses = ysyUserAddressMapper.selectList(Wrappers.lambdaQuery());
        model.addAttribute("myList",ysyUserAddresses);
        return "category";
    }

    @GetMapping("/b")
    public String getB(Model model) {
        List<YsyUserAddress> ysyUserAddresses = ysyUserAddressMapper.selectList(Wrappers.lambdaQuery());
        model.addAttribute("myList",ysyUserAddresses);
        return "brand";
    }

    @GetMapping("/article/{id}")
    public String article(Model model, @PathVariable("id") String id) {
        List<YsyUserAddress> ysyUserAddresses = ysyUserAddressMapper.selectList(Wrappers.lambdaQuery());
        model.addAttribute("myList",ysyUserAddresses);
        return "article";
    }
}
